package com.ywy.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ywy.entity.User;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ywy
 * @description 针对表【user(用户)】的数据库操作Service
 * @createDate 2023-05-18 19:28:53
 */
public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param account       用户账户
     * @param password      用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    long register(String account, String password, String checkPassword);

    /**
     * 用户登录
     *
     * @param account  用户账户
     * @param password 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    User login(String account, String password, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean logout(HttpServletRequest request);
}
